# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ArtifactRegistry.V1.Model.Attachment do
  @moduledoc """
  An Attachment refers to additional metadata that can be attached to artifacts in Artifact Registry. An attachment consists of one or more files.

  ## Attributes

  *   `annotations` (*type:* `map()`, *default:* `nil`) - Optional. User annotations. These attributes can only be set and used by the user, and not by Artifact Registry. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
  *   `attachmentNamespace` (*type:* `String.t`, *default:* `nil`) - The namespace this attachment belongs to. E.g. If an attachment is created by artifact analysis, namespace is set to `artifactanalysis.googleapis.com`.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the attachment was created.
  *   `files` (*type:* `list(String.t)`, *default:* `nil`) - Required. The files that belong to this attachment. If the file ID part contains slashes, they are escaped. E.g. `projects/p1/locations/us-central1/repositories/repo1/files/sha:`.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the attachment. E.g. `projects/p1/locations/us/repositories/repo/attachments/sbom`.
  *   `ociVersionName` (*type:* `String.t`, *default:* `nil`) - Output only. The name of the OCI version that this attachment created. Only populated for Docker attachments. E.g. `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`.
  *   `target` (*type:* `String.t`, *default:* `nil`) - Required. The target the attachment is for, can be a Version, Package or Repository. E.g. `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Type of attachment. E.g. `application/vnd.spdx+json`
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the attachment was last updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotations => map() | nil,
          :attachmentNamespace => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :files => list(String.t()) | nil,
          :name => String.t() | nil,
          :ociVersionName => String.t() | nil,
          :target => String.t() | nil,
          :type => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:annotations, type: :map)
  field(:attachmentNamespace)
  field(:createTime, as: DateTime)
  field(:files, type: :list)
  field(:name)
  field(:ociVersionName)
  field(:target)
  field(:type)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.ArtifactRegistry.V1.Model.Attachment do
  def decode(value, options) do
    GoogleApi.ArtifactRegistry.V1.Model.Attachment.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ArtifactRegistry.V1.Model.Attachment do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
